#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define FOR(i,a,n) for(int i=a,_n(n);i<_n;++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(x) memset(x,0,sizeof(x))
#define STD(x) memset(x,-1,sizeof(x))

typedef long long lld;

using namespace std;


lld dp[1<<17];
int pre[20];
int done[20];
int select[20];
vector<int> larger[20];
int n,m;
lld y;
lld GetState(int mask,int k)
{
	if(k==n+1) return 1;
	if(dp[mask]!=-1) return dp[mask];
	dp[mask] = 0;
	if(select[k])
	{
		int pos = select[k];
		if(pre[pos]) return 0;
		REP(j,larger[pos].size())
		{
			--pre[larger[pos][j]];
		}
		dp[mask] += GetState(mask|(1<<pos),k+1);
		REP(j,larger[pos].size())
		{
			++pre[larger[pos][j]];
		}
		return dp[mask];
	}
	FOR(i,1,n+1) if(!done[i]&&pre[i]==0)
	{
		done[i] = k;
		REP(j,larger[i].size())
		{
			--pre[larger[i][j]];
		}
		dp[mask] += GetState(mask|(1<<i),k+1);
		REP(j,larger[i].size())
		{
			++pre[larger[i][j]];
		}
		done[i] = 0;
	}
	return dp[mask];
};

void GetAns(lld y)
{
	y-=2000;
	STD(dp); CLR(done); CLR(select);
	if(GetState(0,1)<y)
	{
		puts("The times have changed");
		return ;
	}
	FOR(pos,1,n+1)
	{
		FOR(num,1,n+1) if(!select[num])
		{
			done[pos] = num;
			select[num] = pos;
			STD(dp);
			if(GetState(0,1)>=y) break;
			else y -= dp[0];
			select[num] = 0;
		}
	}
	FOR(i,1,n+1) printf("%d ",done[i]);
	cout<<endl;
}
int main()
{
	while(cin>>n>>y>>m)
	{
		CLR(pre);
		REP(i,20) larger[i].clear();
		REP(i,m)
		{
			int a,b;
			scanf("%d%d",&a,&b);
			larger[a].push_back(b);
			++pre[b];
		}
		GetAns(y);
	}
	return 0;
}
